import tableServiceAbstract from "@/core/table/tableService.interface";
import { $roleList, $roleDetail, $roleAdd, $roleEdit,$roleDel, $roleChangeStatus } from "@/api/role/role";
export default class roleService implements tableServiceAbstract {
  getTable(params: any): Promise<any> {
    
    let mParams: { [key: string]: any } = {};
    mParams.page = params.current;
    mParams.limit = params.pageSize;
    params.status && (mParams.status = params.status);
    params.create_time?.[0] && (mParams.create_start_time = (new Date(params.create_time?.[0]?.replace(/-/g, "/")).getTime() / 1000).toFixed(0));
    params.create_time?.[1] && (mParams.create_end_time = (new Date(params.create_time?.[1]?.replace(/-/g, "/")).getTime() / 1000).toFixed(0));
    params.role_name && (mParams.role_name = params.role_name);
    params.role_key && (mParams.role_key = params.role_key);
    return $roleList(mParams);
  }
  delete(params: any): Promise<any> {
    return $roleDel({
      role_ids: params
    });
  }
  add(params: any): Promise<any> {
    return $roleAdd(params);
  }
  edit(params: any): Promise<any> {
    return $roleEdit(params);
  }
  detail(params: any): Promise<any> {
    return $roleDetail(params);
  }
  changeStatus(params: any): Promise<any> {
    return $roleChangeStatus(params);
  }
}
